import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      redirect: "/login"
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      redirect:"/welcome",
      children:[
        {
          path: '/welcome',
          name: 'welcome',
          component: () => import('./components/Welcome.vue')
        },{
          path: '/users',
          name: 'users',
          component: () => import('./components/users/User.vue')
        },{
          path: '/roles',
          name: 'roles',
          component: () => import('./components/power/Roles.vue')
        },{
          path: '/rights',
          name: 'rights',
          component: () => import('./components/power/Rights.vue')
        },{
          path: '/goods',
          name: 'goods',
          component: () => import('./components/goods/Goods.vue')
        },{
          path: '/add',
          name: 'add',
          component: () => import('./components/goods/Add.vue')
        }
        ,{
          path: '/params',
          name: 'params',
          component: () => import('./components/goods/Params.vue')
        },{
          path: '/categories',
          name: 'categories',
          component: () => import('./components/goods/Categories.vue')
        },{
          path: '/orders',
          name: 'orders',
          component: () => import('./components/order/Order.vue')
        },{
          path: '/reports',
          name: 'reports',
          component: () => import('./components/report/Report.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      meta:{requireAuth:true},
      component: () => import('./views/Login.vue')
    }
  ]
})
